﻿/* 方向按钮  arrow.c */ 
#include <gtk/gtk.h> 
GtkWidget* create_arrow_button  (GtkArrowType arrowtype,GtkShadowType shadowtype) 
{ 
	GtkWidget* button; 
	GtkWidget* arrow; 
	button = gtk_button_new(); 
	arrow = gtk_arrow_new(arrowtype,shadowtype); 
	gtk_container_add(GTK_CONTAINER(button),arrow); 
	gtk_widget_show(arrow); 
	return button; 
} 

//主函数 
int main (int argc, char *argv[]) 
{ 
	GtkWidget* window; 
	GtkWidget* box; 
	GtkWidget* arrow1; 
	GtkWidget* arrow2; 
	GtkWidget* arrow3; 
	GtkWidget* arrow4; 
	char* title = "方向按钮"; 
	gtk_init(&argc,&argv); 
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 
	gtk_window_set_title(GTK_WINDOW(window),title); 
	gtk_container_set_border_width(GTK_CONTAINER(window),20); 
	g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL); 
	box = gtk_hbox_new(FALSE,0); 
	gtk_container_add(GTK_CONTAINER(window),box); 
	gtk_widget_show(box); 
	arrow1 = create_arrow_button(GTK_ARROW_LEFT,GTK_SHADOW_IN); 
	gtk_box_pack_start(GTK_BOX(box),arrow1,FALSE,FALSE,13); 
	gtk_widget_show(arrow1); 
	arrow2 = create_arrow_button(GTK_ARROW_UP,GTK_SHADOW_IN); 
	gtk_box_pack_start(GTK_BOX(box),arrow2,FALSE,FALSE,13); 
	gtk_widget_show(arrow2); 
	arrow3 = create_arrow_button(GTK_ARROW_DOWN,GTK_SHADOW_IN); 
	gtk_box_pack_start(GTK_BOX(box),arrow3,FALSE,FALSE,13); 
	gtk_widget_show(arrow3); 
	arrow4 = create_arrow_button(GTK_ARROW_RIGHT,GTK_SHADOW_IN); 
	gtk_box_pack_start(GTK_BOX(box),arrow4,FALSE,FALSE,13); 
	gtk_widget_show(arrow4); 
	gtk_widget_show(window); 
	gtk_main(); 
	return FALSE ; 
} 